package com.ef.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;

import com.ef.dao.TeamDao;
import com.ef.domain.Team;

public class TeamDaoImpl extends DaoImpl<Team> implements TeamDao {
	public List<Team> findByName(String name) {
		StringBuffer hql = new StringBuffer(
				"From Team where (lower(name) like '%");
		hql.append(name.trim().toLowerCase()); 
		hql.append("%') and status='VALID' ");
		return findMultiAll(hql.toString(),0,200);
		// DetachedCriteria criterion = DetachedCriteria.forClass(Team.class);
		// Disjunction or = Restrictions.disjunction();
		// Property myProperty = Property.forName("name");
		// or.add(myProperty.like("%" + name.trim().toLowerCase() + "%"));
		// or.add(myProperty.like("%" + name.trim().toUpperCase() + "%"));
		// criterion.add(or);
		//return findAllByCriteria(criterion);
	}
}
